package com.im.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.im.app.mapper.KuaijieMapper;
import com.im.app.model.Kuaijie;
import com.im.app.service.KuaijieService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 快捷语(Kuaijie)表服务实现类
 *
 * @author makejava
 * @since 2023-03-20 14:21:46
 */
@Service
@Transactional(rollbackFor = Exception.class)
@Slf4j
public class KuaijieServiceImpl implements KuaijieService {

    @Resource
    private KuaijieMapper kuaijieMapper;
    @Override
    public List<Kuaijie> queryKuaijieList() {
        //分页
//        Page<Kuaijie> rowPage = new Page(1, 10);
//        Page<Kuaijie> KuaijiePage = kuaijieDao.selectPage(rowPage, new QueryWrapper<Kuaijie>().orderByDesc("create_time"));
        List<Kuaijie> kuaijieList = kuaijieMapper.selectList(new QueryWrapper<Kuaijie>().orderByDesc("create_time"));
        return kuaijieList;
    }

    @Override
    public Kuaijie findKuaijie(Integer id) {
        return kuaijieMapper.selectById(id);
    }

    @Override
    public int deleteKuaijie(Integer id) {
        return kuaijieMapper.deleteById(id);
    }

    @Override
    public int addKuaijie(Kuaijie kuaijie) {
        return kuaijieMapper.insert(kuaijie);
    }

    @Override
    public int updateKuaijie(Kuaijie kuaijie) {
        return kuaijieMapper.updateById(kuaijie);
    }


}

